$(function () {
    // 配置路径
    var pageUrl = config.urlAnaConfig.testPath;
    // 获取Cookie
    function getCookie(name){
        var strcookie = document.cookie;//获取cookie字符串
        var arrcookie = strcookie.split("; ");//分割
    //       console.log(arrcookie);
        //遍历匹配
        for ( var i = 0; i < arrcookie.length; i++) {
            var arr = arrcookie[i].split("=");
                if (arr[0] ==name){
                    return arr[1];
                }
        }
        return "";
    }
    var name = "tokenval";
    // tiken值
    var cookie_value = getCookie(name);
    console.log(cookie_value);
    var name1 = "userName";
    // 用户名值
    var cookie_value1 = getCookie(name1);
    $(".userName").html(cookie_value1);
    $(".nav-usename").html(cookie_value1);
    var myUrl00 = '';

    /*活动详情*/
    // 渠道
    $.ajax({
        url: pageUrl+'/api/activitydetail/getplatforms',
        type: 'POST',
        dataType: 'json',
        headers: {
            Authorization: 'Bearer '+cookie_value
        },
        success: function (data) {
            var msg = '';
            if (data) {
                if (data.code === 200) {
    //                  店铺名称
                    var details1 = data.data.platforms;
                    var details1F = $(".details1").next('ul');
                    var mydetails1 = details1;
                    /*for in 循环*/
                     for(var i in mydetails1){
                         var text="<li >" + mydetails1[i] + " </li>";
                         details1F.append(text);
                     };
                }
            }
        },
        error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

    });
    $('.det_det').on('click','li',function(){
        $(".details0").val("");
        $(".det_det0 li").remove();
        $(".details2").val("");
        $(".det_det2 li").remove();
        $('.details3').val('');
        $('.det_det3 li').remove();
        $('.details4').val('');
        $('.det_det4 li').remove();
        $(".details0").attr("disabled",false).removeClass("border-hui");
        $(".details2").attr("disabled",true);
        $(".details3").attr("disabled",true);
        $(".details4").attr("disabled",true);
        var details1D= $(this).html();
        console.log(details1D);
        // 店铺
        $.ajax({
            url: pageUrl+'/api/activitydetail/getstoresbyplatform',
            type: 'POST',
            dataType: 'json',
            data:{
                platform:details1D
            },
            headers: {
                Authorization: 'Bearer '+cookie_value
            },
            success: function (data) {
                var msg = '';
                if (data) {
                    if (data.code === 200) {
        //                  店铺名称
                        var details0 = data.data.stores;
                        var details0F = $(".det_det0");

                        /*for in 循环*/
                         for(var i in details0){
                             var text="<li>"+ details0[i] + " </li>";
                             details0F.append(text);
                         };
                    }
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

        });

    })
    $('.det_det0').on('click','li',function(){
        $(".application").removeClass("querenguo").attr("disabled",true);
        $(".details2").attr("disabled",false).removeClass("border-hui");
        var storeData= $(this).html();
        var details1D= $('.details1').val();
        $('.details3').val('').attr("disabled",true);
        $('.details4').val('').attr("disabled",true);
        $('.det_det2 li').remove();
        $('.det_det3 li').remove();
        $('.det_det4 li').remove();
        // 日期
        $.ajax({
            url: pageUrl+'/api/activitydetail/getyearsbyplatformandstore',
            type: 'POST',
            dataType: 'json',
            data:{
                platform:details1D,
                store :storeData
            },
            headers: {
                Authorization: 'Bearer '+cookie_value
            },
            success: function (data) {
                var msg = '';
                if (data) {
                    if (data.code === 200) {
        //                  店铺名称
                        var details2 = data.data.years;
                        console.log(details2);
                        var details2F = $(".det_det2");

                        /*for in 循环*/
                         for(var i in details2){
                             var text="<li>"+ details2[i] + " </li>";
                             details2F.append(text);
                         };
                    }
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

        });

    })
    $('.det_det2').on('click','li',function(){
        $(".application").removeClass("querenguo").attr("disabled",true);
        $(".storeName2").attr("disabled",false).removeClass("border-hui");
        $(".details3 option:gt(0)").remove();
        $(".details4 option:gt(0)").remove();
        $(".details3").attr("disabled",false);
        $(".details4").attr("disabled",true);
        var TimeData= $(this).html();
        var details1D= $('.details1').val();
        var storeData = $('.details0').val();
        $('.details3').val('');
        $('.details4').val('');
        $('.det_det3 li').remove();
        $('.det_det4 li').remove();
        $.ajax({
            url: pageUrl+'/api/activitydetail/getranksbyplatformandstoreandyear',
            type: 'POST',
            dataType: 'json',
            data:{
                platform:details1D,
                store :storeData,
                year :TimeData
            },
            headers: {
                Authorization: 'Bearer '+cookie_value
            },
            success: function (data) {
                var msg = '';
                if (data) {
                    if (data.code === 200) {
        //                  店铺名称
                        console.log("rank");
                        var details3 = data.data.ranks;
                        console.log(data.data);
                        var details3F = $(".details3").next('ul');
                        var mydetails3 = details3;
                        /*for in 循环*/
                         for(var i in mydetails3){
                             var text="<li>" + mydetails3[i] + " </li>";
                             details3F.append(text);
                         };


                    }
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }
        });

    })
    $('.det_det3').on('click','li',function(){
        $(".application").removeClass("querenguo").attr("disabled",true);
        $(".storeName3").attr("disabled",false).removeClass("border-hui");
        $(".details4 option:gt(0)").remove();
        $(".details4").attr("disabled",false);
        var TimeData= $('.details2').val();
        var details1D= $('.details1').val();
        var storeData = $('.details0').val();
        var ranksData= $(this).html();
        $('.details4').val('');
        $('.det_det4 li').remove();
        // 日期
        $.ajax({
            url: pageUrl+'/api/activitydetail/getactivitysbyplatformandstoreandyearandrank',
            type: 'POST',
            dataType: 'json',
            data:{
                platform:details1D,
                store :storeData,
                year :TimeData,
                rank:ranksData
            },
            headers: {
                Authorization: 'Bearer '+cookie_value
            },
            success: function (data) {
                var msg = '';
                if (data) {
                    if (data.code === 200) {
        //                  店铺名称
                        var details4 = data.data.activitys;
                        var details4F = $(".details4").next('ul');
                        var mydetails4 = details4;
                        /*for in 循环*/
                         for(var i in mydetails4){
                             var text="<li activeVal='" + i+ "'>" + mydetails4[i] + " </li>";
                             details4F.append(text);
                         };
                         // 关联3

                    }
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

        });
    })  
    $(".det_det4").on("click","li",function () {
        $(".application").addClass("querenguo").attr("disabled",false);
        $(this).addClass("cur");
    });


    // 活动信息概述DATA
    function hdxx() {
        // var idName = $(".details4").val();
        var idName = 8;
        console.log(idName);
        $.ajax({
            url: pageUrl+'/api/activitydetail/getactivitydata',
            type: 'POST',
            dataType: 'json',
            data:{
                id:idName
            },
            headers: {
                Authorization: 'Bearer '+cookie_value
            },
            success: function (data) {
                var msg = '';
                if (data) {
                    if (data.code === 200) {
        //                  店铺名称
                        console.log("success"+"活动信息概述DATA");
                        var hdxxData = data.data.activity;
                        //console.log(hdxxData)
                        $(".xq1 span").html(hdxxData.stRate);
                        $(".xq1 .detailsP2 span").html(hdxxData.stRateHistory);
                        $(".xq2 span").html(hdxxData.achievingRate);
                        $(".xq2 .detailsP2 span").html(hdxxData.achievingRateHistory);
                        $(".xq3").html(hdxxData.burstCoefficient);
                        $(".xq3_3").html(hdxxData.burstCoefficientHistory);
                        $(".xq4").html('活动期平均折扣：'+hdxxData.discount);
                        $(".xq4_4").html(hdxxData.discountHistory);
                        $(".xq5").html(hdxxData.uvValue);
                        $(".xq5_5").html(hdxxData.uvValueHistory);
                        $(".xq6").html(hdxxData.upt);
                        $(".xq6_6").html(hdxxData.uptHistory);
                        $(".xq7").html(hdxxData.cup);
                        $(".xq7_7").html(hdxxData.cupHistory);
                        $(".xq8").html(hdxxData.cr);
                        $(".xq8_8").html(hdxxData.crHistory);
                        $(".xq9").html(hdxxData.payOrders);
                        $(".xq9_9").html(hdxxData.payOrdersHistory);
                        $(".xq10").html(hdxxData.payCusts);
                        $(".xq10_10").html(hdxxData.payCustsHistory);
                        $(".xq11").html(hdxxData.payAmount);
                        $(".xq11_11").html(hdxxData.pay_amount_history);
                        $(".xq12 .detailsP1 .fl").html(hdxxData.jhs.jhsEnroll);
                        $(".xq12 .detailsP1 .center11").html(hdxxData.jhs.jhsPaynum);
                        $(".xq12 .detailsP1 .fr").html(hdxxData.jhs.jhsPayamount);
                        $(".xq13 .detailsP1 .fl").html(hdxxData.tqg.tqgEnroll);
                        $(".xq13 .detailsP1 .center11").html(hdxxData.tqg.tqgPaynum);
                        $(".xq13 .detailsP1 .fr").html(hdxxData.tqg.tqgPayamount);
                    }
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

        });
    }
    hdxx();
    // 图表初始化
    function hdxxTT() {
            $.ajax({
                url: pageUrl+'/api/common/getaccesstoken',
                type: 'POST',
                dataType: 'json',
                success: function (data) {
                    var msg = '';
                    if (data) {
                        var accessToken = data.data.accessToken.value;
                        console.log(accessToken);
                        var embedvisualName = "0798483eed83ee608075";
                        var myUrl00 = "https://app.powerbi.cn/reportEmbed?reportId=564b905b-0343-4187-9c20-f04d7dfaef68&groupId=13e42e94-3404-46d8-b605-228c35984df3";
                        tuzong(accessToken,myUrl00);
                        dantu1(accessToken,embedvisualName,myUrl00);
                        yuce(accessToken,myUrl00);
                    }
                },
                error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }
            });
    }
    hdxxTT();

    function tuzong(accessToken,myUrl22) {
                accessToken = accessToken;
                // Read embed URL from Model
                // var embedUrl = "https://app.powerbi.cn/reportEmbed?reportId=f96f7cf9-2b8c-4021-a1a4-17883dca703f&groupId=13e42e94-3404-46d8-b605-228c35984df3&filter=store_table/store_name_cn eq 'ONITSUKA_TIGER天猫旗舰店'";
                var embedUrl = myUrl22;
                console.log(embedUrl);
                // Read report Id from Model
                var embedReportId = "564b905b-0343-4187-9c20-f04d7dfaef68";
                var embedpageName = "ReportSection328b8e6409e26f3d0bb3";
                var embedvisualName = "d14b086b4487fc1bde72";
                // Get models. models contains enums that can be used.
                var models = window['powerbi-client'].models;
                // Embed configuration used to describe the what and how to embed.
                // This object is used when calling powerbi.embed.
                // This also includes settings and options such as filters.
                // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
                var config = {
                    type: 'visual',
                    // tokenType: models.TokenType.Embed,
                    accessToken: accessToken,
                    embedUrl: embedUrl,
                    id: embedReportId,
                    pageName: embedpageName,
                    visualName: embedvisualName,
                    // filters: filter
                };
                // Get a reference to the embedded report HTML element
                var tu11 = $('.tu11')[0];
                var report = powerbi.embed(tu11, config);
                report.getFilters(models.FiltersLevel.Report)
                .then(function (filters) {
                    consolo.log(filters);
                })
                .catch(function (errors) {
                    consolo.log(errors);
                });
    };

    // 单图
    function dantu1(accessToken,embedvisualName,myUrl00) {
        // Read embed application token from Model
        accessToken = accessToken;
        // var accessToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkZDQmFtTFdha2tLWVhTMFFEdDJYcVFha2JPRSIsImtpZCI6IkZDQmFtTFdha2tLWVhTMFFEdDJYcVFha2JPRSJ9.eyJhdWQiOiJodHRwczovL2FuYWx5c2lzLmNoaW5hY2xvdWRhcGkuY24vcG93ZXJiaS9hcGkiLCJpc3MiOiJodHRwczovL3N0cy5jaGluYWNsb3VkYXBpLmNuLzlhZWJiZmVkLTc1MmMtNDVhYy1iZDhiLTg2ODczODZiYjg0ZS8iLCJpYXQiOjE1NTIyODYxNzUsIm5iZiI6MTU1MjI4NjE3NSwiZXhwIjoxNTUyMjkwMDc1LCJhY2N0IjowLCJhY3IiOiIxIiwiYWlvIjoiQVNRQTIvOENBQUFBcyt0UEZTVUxCcGUvekkvaWJNNHEzNG5BdVVYSnRjMXFGdWpNWHF1bGwycz0iLCJhbXIiOlsicHdkIl0sImFwcGlkIjoiZmVjNDAxZTQtNjM0NS00ZGVmLTkwMDEtMGQ2YTUxYjJmZGFjIiwiYXBwaWRhY3IiOiIwIiwiZmFtaWx5X25hbWUiOiLpu4QiLCJnaXZlbl9uYW1lIjoi5a2Q5oG6IiwiaXBhZGRyIjoiNTguMzcuMjguMTEiLCJuYW1lIjoi6buE5a2Q5oG6Iiwib2lkIjoiZTYwZjllODEtYmZiZS00ODQ1LWE4ZjItZjQ1MzRlYWJjNzBmIiwicHVpZCI6IjIwMDNCRkZEODE2RUZFREMiLCJzY3AiOiJBcHAuUmVhZC5BbGwgQ2FwYWNpdHkuUmVhZC5BbGwgQ2FwYWNpdHkuUmVhZFdyaXRlLkFsbCBDb250ZW50LkNyZWF0ZSBEYXNoYm9hcmQuUmVhZC5BbGwgRGFzaGJvYXJkLlJlYWRXcml0ZS5BbGwgRGF0YS5BbHRlcl9BbnkgRGF0YXNldC5SZWFkLkFsbCBEYXRhc2V0LlJlYWRXcml0ZS5BbGwgR2F0ZXdheS5SZWFkLkFsbCBHYXRld2F5LlJlYWRXcml0ZS5BbGwgR3JvdXAuUmVhZCBHcm91cC5SZWFkLkFsbCBNZXRhZGF0YS5WaWV3X0FueSBSZXBvcnQuUmVhZC5BbGwgUmVwb3J0LlJlYWRXcml0ZS5BbGwgVGVuYW50LlJlYWQuQWxsIFRlbmFudC5SZWFkV3JpdGUuQWxsIFdvcmtzcGFjZS5SZWFkLkFsbCBXb3Jrc3BhY2UuUmVhZFdyaXRlLkFsbCIsInN1YiI6IjJSTmlxbkg1RDV4c19Yd2VCNmFISnN4STNrcEN5QWdIRmZlY0JGeWtrMHciLCJ0aWQiOiI5YWViYmZlZC03NTJjLTQ1YWMtYmQ4Yi04Njg3Mzg2YmI4NGUiLCJ1bmlxdWVfbmFtZSI6Inppa2FpQHNhcHp6LnBhcnRuZXIub25tc2NoaW5hLmNuIiwidXBuIjoiemlrYWlAc2FwenoucGFydG5lci5vbm1zY2hpbmEuY24iLCJ1dGkiOiJYMDRjV1ZmM0kwU21IZXJxOHdBT0FBIiwidmVyIjoiMS4wIiwid2lkcyI6WyI2MmU5MDM5NC02OWY1LTQyMzctOTE5MC0wMTIxNzcxNDVlMTAiXX0.RE4kvUZwrRO006dV8gVmbCxh2MqLFGwvCVav0ttSNvQJnvtweqA6bzkzJMdKozjqBmffe2ePbUDR4r2JLt86ch7ACuOEOQmRYNz-MzFQjN-vdJvfbIIFoP9d_Lz7N7uJLk7xrR5CbJn_68clOmu1EZrHB1zMBTfXbEtcTlzQtRQtGoYff6all_OsfGyz_B5MCKSq1tv7iPTOc0MgkFxkvqcezrENi79wcKPQvFeaDQMN-PrRVFA5ypJEr40lrXZp5VrwuL3xYbHiMaZDHSIFgvWoILs6O0thG2yG0l2QmvjIUxP2wE9Suva4ksfC86qdXw68OiAaLYP393x4K-eTjg";
        // Read embed URL from Model
        // var embedUrl = "https://app.powerbi.cn/reportEmbed?reportId=f96f7cf9-2b8c-4021-a1a4-17883dca703f&groupId=13e42e94-3404-46d8-b605-228c35984df3&filter=store_table/store_name_cn eq 'ONITSUKA_TIGER天猫旗舰店'";
        var embedUrl = myUrl00;
        console.log(embedUrl);
        // Read report Id from Model
        var embedReportId = "564b905b-0343-4187-9c20-f04d7dfaef68";
        var embedpageName = "ReportSection328b8e6409e26f3d0bb3";
        var embedvisualName = embedvisualName;
        // Get models. models contains enums that can be used.
        var models = window['powerbi-client'].models;
        // Embed configuration used to describe the what and how to embed.
        // This object is used when calling powerbi.embed.
        // This also includes settings and options such as filters.
        // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
        var config = {
            type: 'visual',
            // tokenType: models.TokenType.Embed,
            accessToken: accessToken,
            embedUrl: embedUrl,
            id: embedReportId,
            pageName: embedpageName,
            visualName: embedvisualName,
            // filters: filter
        };
        // Get a reference to the embedded report HTML element
        var tu22 = $('.tu22')[0];
        var report = powerbi.embed(tu22, config);
        report.getFilters(models.FiltersLevel.Report)
        .then(function (filters) {
            consolo.log(filters);
        })
        .catch(function (errors) {
            consolo.log(errors);
        });
    };

    // 预测效果图
    function yuce(accessToken,myUrl11) {
        // Read embed application token from Model
        var accessToken = accessToken
        // Read embed URL from Model
        var embedUrl = myUrl11;
        console.log(embedUrl);
        // Read report Id from Model
        var embedReportId = "b4d3a8a7-1062-4303-a64a-99d6ab85f2a7";
        // Get models. models contains enums that can be used.
        var models = window['powerbi-client'].models;
        // Embed configuration used to describe the what and how to embed.
        // This object is used when calling powerbi.embed.
        // This also includes settings and options such as filters.
        // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
        var config = {
            type: 'report',
            // tokenType: models.TokenType.Embed,
            accessToken: accessToken,
            embedUrl: embedUrl,
            id: embedReportId,
            viewMode: models.ViewMode.View,
            // filters: filter,
            permissions: models.Permissions.All ,
            settings: {
                filterPaneEnabled: false,
                navContentPaneEnabled: false
            }
        };
        // Get a reference to the embedded report HTML element
        var tu33 = $('.tu33')[0];
        if ("" != "") {
            $("#RLS").prop('checked', true);
            $("#RLSdiv").show();
        }
        else
        {
            $("#RLS").prop('checked', false);
            $("#RLSdiv").hide();
        }
        if ("False" == "True") {
            $("#noRLSdiv").hide();
            $("#RLS").removeAttr("disabled");
            $("#RLS").change(function () {
                if ($(this).is(":checked")) {
                    $("#RLSdiv").show(300);
                } else {
                    $("#RLSdiv").hide(200);
                }
            });
        }
        else
        {
            $("#noRLSdiv").show();
        }
        var report = powerbi.embed(tu33, config);
    };

    // 切换小图
    $(".detailsC").on("click",function () {
        var choseName = $(this).find("input").val();
        $.ajax({
                url: pageUrl+'/api/common/getaccesstoken',
                type: 'POST',
                dataType: 'json',
                success: function (data) {
                    var msg = '';
                    if (data) {
                        var accessToken = data.data.accessToken.value;
                        var myUrl00 = "https://app.powerbi.cn/reportEmbed?reportId=c8c37954-e86b-4be2-8d7a-a824c8392a92&groupId=13e42e94-3404-46d8-b605-228c35984df3";
                        dantu1(accessToken,choseName,myUrl00);
                    }
                },
                error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }
            });
    });

    // 选择请求
    var pingjieIndex1 = 0;
    var pingjieIndex2 = 0;
    var pingjieIndex3 = 0;
    $(".application").on("click",function (e) {
         var event=e||event
         event.preventDefault()
        var platform = $(".details1").val();
        var year = $(".details2").val();
        var store = $(".details3").val();
        var activity = $(".det_det4 .cur").attr("activeVal");
        if (platform == 0 || year==0 || store==0 || activity==0){
            alert("请选择完整选项");
            return false;
        };
        // 拼接图形盒子1
        pingjieIndex1++;
        var tu1Id = "reportContainer2";
        tu1Id = tu1Id + pingjieIndex1;
        console.log(tu1Id);
        var arrtx1 = [];
        arrtx1.push("<div class='tu11 no-border'" + "id=" +tu1Id +">");
        arrtx1.push("</div>");
        str1 = arrtx1.join('');
        $(".tu1").append(str1);
        // 删除其他元素
        $('.tu1'+' #'+tu1Id).siblings().remove();

        // 拼接图形盒子2
        pingjieIndex2++;
        var tu2Id = "reportContainer11";
        tu2Id = tu2Id + pingjieIndex2;
        console.log(tu2Id);
        var arrtx2 = [];
        arrtx2.push("<div class='tu22 no-border'" + "id=" +tu2Id +">");
        arrtx2.push("</div>");
        str2 = arrtx2.join('');
        $(".tu2").append(str2);
        // 删除其他元素
        $('.tu2'+' #'+tu2Id).siblings().remove();

        // 拼接图形盒子3
        pingjieIndex3++;
        var tu3Id = "reportContainer12";
        tu3Id = tu3Id + pingjieIndex3;
        console.log(tu3Id);
        var arrtx3 = [];
        arrtx3.push("<div class='tu33 no-border'" + "id=" +tu3Id +">");
        arrtx3.push("</div>");
        str3 = arrtx3.join('');
        $(".tu3").append(str3);
        $('.tu3'+' #'+tu3Id).siblings().remove();


        // 单图
        var myUrl = "https://app.powerbi.cn/reportEmbed?reportId=564b905b-0343-4187-9c20-f04d7dfaef68&groupId=13e42e94-3404-46d8-b605-228c35984df3";
        // 预测
        var muUrl2 = "https://app.powerbi.cn/reportEmbed?reportId=b4d3a8a7-1062-4303-a64a-99d6ab85f2a7&groupId=13e42e94-3404-46d8-b605-228c35984df3";
        // 信息
        var muUrl3 = "https://app.powerbi.cn/reportEmbed?reportId=564b905b-0343-4187-9c20-f04d7dfaef68&groupId=13e42e94-3404-46d8-b605-228c35984df3";
        myUrl00 = myUrl+"&filter=activity/activity_id eq "+activity;
        myUrl11 = muUrl2+"&filter=activity/activity_id eq "+activity;
        myUrl22 = muUrl3+"&filter=activity/activity_id eq "+activity;
        $.ajax({
            url: pageUrl+'/api/activitydetail/getactivitydata',
            type: 'POST',
            dataType: 'json',
            data:{
                id:activity
            },
            headers: {
                Authorization: 'Bearer '+cookie_value
            },
            success: function (data) {
                var msg = '';
                if (data) {
                    if (data.code === 200) {
        //                  店铺名称
                        console.log("success"+"活动信息概述DATA");
                        var hdxxData = data.data.activity;
                        console.log(hdxxData.stRate+"22222222222");
                        $(".xq1 span").html(hdxxData.stRate);
                        $(".xq1 .detailsP2 span").html(hdxxData.stRateHistory);
                        $(".xq2 span").html(hdxxData.achievingRate);
                        $(".xq2 .detailsP2 span").html(hdxxData.achievingRateHistory);
                        $(".xq3").html(hdxxData.burstCoefficient);
                        $(".xq3_3").html(hdxxData.burstCoefficientHistory);
                        $(".xq4").html(hdxxData.discount);
                        $(".xq4_4").html(hdxxData.discountHistory);
                        $(".xq5").html(hdxxData.uvValue);
                        $(".xq5_5").html(hdxxData.uvValueHistory);
                        $(".xq6").html(hdxxData.upt);
                        $(".xq6_6").html(hdxxData.uptHistory);
                        $(".xq7").html(hdxxData.cup);
                        $(".xq7_7").html(hdxxData.cupHistory);
                        $(".xq8").html(hdxxData.cr);
                        $(".xq8_8").html(hdxxData.crHistory);
                        $(".xq9").html(hdxxData.payOrders);
                        $(".xq9_9").html(hdxxData.payOrdersHistory);
                        $(".xq10").html(hdxxData.payCusts);
                        $(".xq10_10").html(hdxxData.payCustsHistory);
                        $(".xq11").html(hdxxData.payAmount);
                        $(".xq11_11").html(hdxxData.pay_amount_history);
                        //$(".xq12 .detailsP1 .fl").html(hdxxData.jhs.jhsEnroll);
                       // $(".xq12 .detailsP1 .center11").html(hdxxData.jhs.jhsPaynum);
                       // $(".xq12 .detailsP1 .fr").html(hdxxData.jhs.jhsPayamount);
                      //  $(".xq13 .detailsP1 .fl").html(hdxxData.tqg.tqgEnroll);
                       // $(".xq13 .detailsP1 .center11").html(hdxxData.tqg.tqgPaynum);
                       // $(".xq13 .detailsP1 .fr").html(hdxxData.tqg.tqgPayamount);
                    }
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

        });
        // 图表
        $.ajax({
            url: pageUrl+'/api/common/getaccesstoken',
            type: 'POST',
            dataType: 'json',
            success: function (data) {
                var msg = '';
                if (data) {
                    var accessToken = data.data.accessToken.value;
                    var embedvisualName = "0798483eed83ee608075";
                    tuzong(accessToken,myUrl22);
                    yuce(accessToken,myUrl11);
                    dantu1(accessToken,embedvisualName,myUrl00);
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

        });
    });
    /*活动详情*/
});
